import { Common } from '../common/common.js';
import { MyModel } from '../../../modules/my.js';

const app = getApp();
const my = new MyModel();
const common = new Common();

Page({
  data: {
    positions: [],
    loading: false
  },
  // 加载投递记录
  loadDeliveryLogs() {
    my.getDeliveryLogs(common.getRid())
    .then(res => {
      if(res.code == 2) {
        this.setData({
          positions: res.data.recruitmentList,
          loading: true
        })
      }else {
        this.setData({
          loading: true
        })
      }
    })
  },
  onShow: function () {
    // 判断是否授权
    app.isAuthize()
    .then(res => {
      if(res) {
        this.loadDeliveryLogs()
      }else {
        this.setData({
          loading: true
        })
      }
    })
  }
})